package com.xcesys.extras.tool.exporter;

import java.io.File;

import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2x.GenericExporter;
import org.hibernate.tool.hbm2x.pojo.POJOClass;

public class ExtrasDataObjectExpporter extends GenericExporter {

	public ExtrasDataObjectExpporter() {
		init();
	}

	public ExtrasDataObjectExpporter(Configuration cfg, File outputdir) {
		super(cfg, outputdir);
		init();
	}

	public String getName() {
		return "model2dataobject";
	}

	protected String getPackageNameForFile(POJOClass element) {
		if (getProperties().containsKey("packageName")) {
			return getProperties().getProperty("packageName") + ".action";
		}
		return element.getPackageName();
	}

	protected void init() {
		setTemplateName("dataobject/dataobject" + ".ftl");
		setFilePattern("{package-name}/" + "{class-name}DO" + ".java");
	}

	@Override
	protected String resolveFilename(POJOClass element) {
		return super.resolveFilename(element);
	}

}
